www.gusucode.com > 通用 ThunkC++源码程序 > 通用 Thunk/GenericThunk_source_sample/GenericThunk_source/GenericThunk_source/src/Thunk/StdToStd.cpp
#include <Thunk/StdToStd.h> #define THUNK_MACHINE_CODE_IMPLEMENT #include <Thunk/MachineCodeMacro.h> namespace Thunk { dword_ptr StdToStd::GetObject() const { return m_this; } void StdToStd::SetObject(dword_ptr newObj) { m_this = newObj; Helper::FlushInstructionCache(&m_this,sizeof(m_this)); } dword StdToStd::GetMethod() const { return Helper::GetTransferDST(&JMP); } void StdToStd::SetMethod(dword newMethod) { Helper::SetTransferDST(&JMP,newMethod); Helper::FlushInstructionCache(&m_method,sizeof(m_method)); } StdToStd::~StdToStd() {} StdToStd::StdToStd(dword_ptr Obj,dword method) STD_TO_STD_CODES() { SetObject(Obj); SetMethod(method); } StdToStd::StdToStd(const StdToStd &src) STD_TO_STD_CODES() { *this = src; } StdToStd& StdToStd::operator =(const Thunk::StdToStd &rhs) { SetObject( rhs.GetObject() ); SetMethod( rhs.GetMethod() ); return *this; } bool StdToStd::operator == (const StdToStd &rhs) const { return (GetObject()==rhs.GetObject() && GetMethod()==rhs.GetMethod()); } bool StdToStd::operator != (const StdToStd &rhs) const { return !(*this==rhs); } dword_ptr StdToStd::Attach(dword_ptr newObj) { dword_ptr oldObj = GetObject(); SetObject(newObj); return oldObj; } dword StdToStd::Attach(dword newMethod) { dword oldMetod = GetMethod(); SetMethod(newMethod); return oldMetod; } }